package cn.acup.boot.config;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

/**
 * 拦截器-实现
 * @author alan.zhao
 */
public class InterceptorConfig implements HandlerInterceptor{ 
	
	private Logger logger = LoggerFactory.getLogger(InterceptorConfig.class);
	  
    /** 
     * 进入controller层之前拦截请求 
     */  
	@Override
    public boolean preHandle(HttpServletRequest httpServletRequest, 
    		HttpServletResponse httpServletResponse, Object o) throws Exception {  
		logger.warn("*********开始进入请求地址拦截*********");  
        return true;  
  
    }  
	
	@Override
    public void postHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, ModelAndView modelAndView) throws Exception {  
		logger.warn("********处理请求完成后视图渲染之前的处理操作********");  
    }  
	
	@Override
    public void afterCompletion(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) throws Exception {  
		logger.warn("********视图渲染之后的操作********");  
    }  
}  
